package p1;
import p1_1.*;

public class Selection implements IntSort
{
   @Override 
   public int[] sort(int[] array)
   {
       System.out.println("Selection");
       int[] arr2 = new int[array.length];
       for(int i=0; i<array.length; i++)
       {
           arr2[i] = swap(array);
       }
       return arr2;
   }
    
   public int swap(int[] arr)
   {
       int min = arr[0];
       int index = 0;
       for(int i=0; i<arr.length; i++)
       {
           if(min>arr[i])
           {
               min = arr[i];
               index = i;
            }
        }
        arr[index] = 0x7fffffff;
        return min;
   }
}
